package com.example.demo;

import java.io.File;

public class updateFile {

    public static void main(String[] args) {
        // G:\BaiduNetdiskDownload\Java全栈课程\资料
        File folder = new File("G:\\BaiduNetdiskDownload\\从零开始带你成为MySQL实战优化高手");
        //获取该目录下所有文件的File数组
        File[] fileArray = folder.listFiles();
        for (File f : fileArray) {
            //System.out.println(f);
            String name = f.getName();
            String newName = name.replace("-watermark", "");
            //System.out.println(newName);
            File newFile = new File(folder, newName);
            f.renameTo(newFile);
        }

    }
}
